package ctp.statesgraph;

public class PolicyAction {

	Action action;
	double cost;
	
	public PolicyAction(Action action, double cost) {
		super();
		this.action = action;
		this.cost = cost;
	}

	@Override
	public String toString() {
		return String.format("PolicyAction [%s c:%.2f]", action, cost);
	}

	public Action getAction() {
		return action;
	}

	public double getCost() {
		return cost;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((action == null) ? 0 : action.hashCode());
		long temp;
		temp = Double.doubleToLongBits(cost);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PolicyAction other = (PolicyAction) obj;
		if (action == null) {
			if (other.action != null)
				return false;
		} else if (!action.equals(other.action))
			return false;
		if (Double.doubleToLongBits(cost) != Double
				.doubleToLongBits(other.cost))
			return false;
		return true;
	}
	
	
	
}
